package com.woniu.liuzhougov.report.controller;


import com.woniu.liuzhougov.authorityControl.pojo.User;
import com.woniu.liuzhougov.report.pojo.Report;
import com.woniu.liuzhougov.report.service.AwaitingApprovalReportService;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 专报 处理
 */
@Controller
@RequestMapping("AwaitingApprovalReportManage")
public class AwaitingApprovalReportController {


    @Autowired
    private AwaitingApprovalReportService reportService;


    /**
     * 待审批 专报
     * @return
     */
    @RequestMapping("/listAwaitingApprovalReport")
    @ResponseBody
    public Map listAwaitingApprovalReport(){
        Map<String,Object> map = new HashMap<>();
        User user = (User) SecurityUtils.getSubject().getPrincipal();  //查询登录账户ID
        List<Report> list =  reportService.listQReport(user.getUserId());
        map.put("count",list.size());
        map.put("data",list);
        map.put("code",0);
        map.put("msg","");
        return map;
    }
}
